//
//  BaseTableViewController.m
//  Trackit
//
//  Created by yaodaobin on 2017/4/2.
//  Copyright © 2017年 yaodaobin. All rights reserved.
//

#import "BaseTableViewController.h"

@interface BaseTableViewController ()

@end

@implementation BaseTableViewController
#pragma mark - Controller
- (void)viewDidLoad {
    [super viewDidLoad];
    [self initParams];
    [self initUI];
}

- (void)initParams {
    self.data = [NSMutableArray array];
}

- (void)initUI {
    [self.view addSubview:self.tableView];
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.insets(UIEdgeInsetsZero);
    }];
    
    kWeakSelf
    if (!self.hideRefreshHeader) {
        MJRefreshHeader *header = [MJRefreshHeader headerWithRefreshingBlock:^{
            [weakSelf pullReload];
        }];
        self.tableView.mj_header = header;
    }
    if (!self.hideRefreshFooter) {
        MJRefreshFooter *footer = [MJRefreshFooter footerWithRefreshingBlock:^{
            [weakSelf loadMore];
        }];
        self.tableView.mj_footer = footer;
    }

}

#pragma mark - Getter
- (UITableView *)tableView {
    if (!_tableView) {
        _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
        _tableView.dataSource = self;
        _tableView.delegate = self;
    }
    return _tableView;
}

#pragma mark - Public
- (void)reloadData {
    
}

- (void)pullReload {
    
}

- (void)loadMore {
    
}

- (void)reloadFinished {
    _reloading = NO;
    [self.tableView.mj_footer resetNoMoreData];
}

- (void)loadMoreFinished {
    [self.tableView.mj_footer endRefreshing];
}

#pragma mark - UITableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 0;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    return nil;
}

@end
